"""
"""

from agent import agent
from agent1 import agent as agent1
from game_runner import GameRunner
from loa_game import WHITE, BLACK, LinesOfActionState, SpinAction, MoveAction, DIRECTIONS, Direction
from game_agent import GameAgent
from alpha_beta import AlphaBetaSearch
from heu import alot, num_con, variance, glob_sum_dis


class DummyAgent(GameAgent):
    def move(self, game_state):
        for action in game_state.getSuccessors().keys():
            return action
    
    def setup(self, player, game_state, turn_time_limit, setup_time_limit):
        return

agents = {}
wins = {}

for depth in range(2,5):
    
    agents[WHITE] = agent(depth)
    agents[BLACK] = DummyAgent()
    for game in range(3,7):
    
        state = LinesOfActionState(game, 50)
        try:
            states, winner = GameRunner(state, agents, 20, 20).run()
        except:
            try:
                wins[depth] -= 1
            except:
                wins[depth] = -1
        
        if   winner is BLACK:
            try:
                wins[depth] -= 1
            except:
                wins[depth] = -1
        elif   winner is WHITE: 
            try:
                wins[depth] += 1
            except:
                wins[depth] = 1

import matplotlib.pyplot as plt
plt.plot(wins.keys(), wins.values())
plt.show()



"""
num_con_data = map(num_con,states)
variance_data = map(variance,states)
sum_dis_data = map(glob_sum_dis,states)





import numpy as np


p1, = plt.plot(range(len(sum_dis_data)), sum_dis_data,'g')
p2, = plt.plot(range(len(variance_data)), variance_data,'b')
p3, = plt.plot(range(len(num_con_data)), num_con_data,'r')

plt.legend( (p1, p2, p3), ('sum', 'var', 'num', ) )
plt.show()
"""